package com.app.common.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.app.common.obj.UIFrameworkContent;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhoulikai on 17/2/16.
 */

public class UIFragmentPagerAdapter extends FragmentPagerAdapter {
    private List<UIFrameworkContent> uiFrameworkContents = new ArrayList<>();

    public UIFragmentPagerAdapter(FragmentManager fm, List<UIFrameworkContent> uiFrameworkContents) {
        super(fm);
        this.uiFrameworkContents = uiFrameworkContents;
    }

    @Override
    public Fragment getItem(int position) {
        return uiFrameworkContents.get(position).getFragment();
    }

    @Override
    public int getCount() {
        return uiFrameworkContents.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return uiFrameworkContents.get(position).getTitle();
    }
}
